package org.example;

import org.beetl.core.Configuration;
import org.beetl.core.GroupTemplate;
import org.beetl.core.Template;
import org.beetl.core.resource.StringTemplateResourceLoader;

import java.io.IOException;
import java.util.*;

import static org.beetl.core.Configuration.*;

/**
 * @ClassName: ${NAME}
 * @Author: 闲.大赋(李家智)
 * @Date: 2024/7/23 22:52
 * @Since: JDK1.8
 * @Version: 1.0
 */
public class Main {
    public static void main(String[] args) throws IOException {
        StringTemplateResourceLoader resourceLoader = new StringTemplateResourceLoader();
        Properties prop = new Properties();
        prop.put(ENGINE,MyPlaceHolderEngine.class.getName());
//        prop.put(DELIMITER_PLACEHOLDER_START,"#{");
//        prop.put(DELIMITER_PLACEHOLDER_END,"}");

        Configuration configuration = new Configuration(prop);
//        Configuration configuration = Configuration.defaultConfiguration();
        GroupTemplate gt = new GroupTemplate(resourceLoader, configuration);
        Template template = gt.getTemplate("hello,${name}${nam1e}");
        Map<String, Object> map = new HashMap<>();
        List<String> names = new ArrayList<>();
        names.add("java");
        names.add("c");
        names.add("python");
        map.put("name",names);
        template.binding(map);
        String render = template.render();
        System.out.println(render);
    }
}
